<extend name="Public/baseConf"/>
<block name="breadcrumb"> 
	<div class="row wrapper border-bottom white-bg page-heading">
	    <div class="col-lg-6">
	        <h2>配置管理
	        <small><present name="Think.get.group">
			         <a href="{:U('index')}"><span class='btn btn-sm btn-white btn-round'>全部</span></a>
			         <else/>
			         <span class='btn btn-sm btn-info btn-round'>全部</span>
		         </present>&nbsp;
		        <foreach name="group" item="vo">
				<neq name="group_id" value="$key">
			         <a href="{:U('index?group='.$key)}"><span class='btn btn-sm btn-white btn-round'>{$vo}</span></a>
			         <else/>
			         <span class='btn btn-sm btn-info btn-round'>{$vo}</span>
			         </neq>&nbsp;     
		        </foreach>
        	</small>
	        </h2>
	        <ol class="breadcrumb">
	            <li><a href="{:U('index/index')}">首页</a></li>
	            <li class="active">
	                <strong>配置管理</strong>
	            </li>
	        </ol>
	    </div>
	    <div class="col-lg-6">
            <div class="title-action">
				<span class="block pull-left">
					<a class="btn btn-primary" href="{:U('add')}">
						<i class="fa fa-pencil align-top"></i>新增
					</a>
			        <a class="btn btn-danger" href="javascript:;">
						<i class="fa fa-trash align-top"></i>删除
					</a>
					<a class="btn btn-warning btn-success" href="{:U('sort?group='.I('group'),'','')}">
						<i class="fa fa-flag"></i>排序
					</a>
				</span>
				<div class="input-group">
					<input type="text" class="form-control search-input" name="name" value="{:I('name')}" placeholder="请输入配置名称"> 
					<span class="input-group-btn"> 
						<a id="search" type="button"  url="{:U('config/index')}" class="btn btn-primary"><i class="fa fa-search green bigger-125"></i></a> 
	                </span>
	            </div>
            </div>
        </div>
	</div>
</block>
<block name="body">
	<div class="row">
            <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>配置管理列表</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="table-responsive">
                    <form class="ids">
		                  <table class="table table-striped table-bordered table-hover dataTables-example" >
			                  <thead>
			                  <tr>
									<th class="row-selected row-selected">
									<label><input type="checkbox" class="check-all" /><span class="lbl"></span></label></th>
									<th class="center">操作</th>
									<th class="center">ID</th>
									<th class="center">名称</th>
									<th class="center">标题</th>
									<th class="center">分组</th>
									<th class="center">类型</th>
									<th></th>
			                  </tr>
			                  </thead>
			                  <tbody>
									<notempty name="list">
									<volist name="list" id="config">
									<tr>
							            <td class="center">
											<label>
												<input type="checkbox" class="ids" name="id[]" value="{$config.id}"/>
												<span class="lbl"></span>
											</label></td>
										<td class="center">
											<a title="编辑" class="green" href="{:U('edit?id='.$config['id'])}"><i class="fa fa-pencil bigger-130"></i></a>&nbsp;&nbsp; 
							                <a title="删除" class="red ajax-get" href="{:U('del?id='.$config['id'])}"><i class="fa fa-trash-o bigger-130"></i></a>
							            </td>
										<td class="center">{$config.id}</td>
										<td><a href="{:U('edit?id='.$config['id'])}">{$config.name}</a></td>
										<td>{$config.title}</td>
										<td class="center">{$config.group|get_config_group}</td>
										<td class="center">{$config.type|get_config_type}</td>
				
							            <td></td>
									</tr>
									</volist>
									<else/> 
									<td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
									</notempty>
			                  </tbody>
		                  </table>
		            </form>
		            <div class="page pull-right">
				     	{$_page}
			 		</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</block>

<block name="script">
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.input-group').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
	//点击排序
	$('.list_sort').click(function(){
		var url = $(this).attr('url');
		var ids = $('.ids:checked');
		var param = '';
		if(ids.length > 0){
			var str = new Array();
			ids.each(function(){
				str.push($(this).val());
			});
			param = str.join(',');
		}

		if(url != undefined && url != ''){
			window.location.href = url + '/ids/' + param;
		}
	});
});
</script>
</block>